package com.clgc.eduservice.service.impl;

import com.clgc.eduservice.entity.StudentTask;
import com.clgc.eduservice.mapper.StudentTaskMapper;
import com.clgc.eduservice.service.StudentTaskService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import com.clgc.eduservice.entity.StudentTopic;
import com.clgc.eduservice.service.StudentTopicService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * <p>
 * 学生和作业表 服务实现类
 * </p>
 *
 * @author testjava
 * @since 2021-04-27
 */
@Service
public class StudentTaskServiceImpl extends ServiceImpl<StudentTaskMapper, StudentTask> implements StudentTaskService {

    @Autowired
    StudentTopicService topicService;

    @Override
    public boolean subTask(List<StudentTopic> list, StudentTask studentTask) {

        list.stream().forEach(topic -> {
            topicService.subTopic(topic);
        });
        int flag = baseMapper.updateById(studentTask);

        return flag > 0 ? true : false;
    }
}
